home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / harrythehamster.swf / scripts / frame_44 / DoAction.as
Encoding:
Text File  |  2007-09-28  |  3.0 KB  |  120 lines

  1. if(drag && !mouseButton)
  2. {
  3.    drag = false;
  4.    ┬º┬ºpush(grid);
  5.    ┬º┬ºpush("_visible");
  6.    ┬º┬ºpush(false);
  7. }
  8. else
  9. {
  10.    if((status == "waiting" || status == "moving") && mouseButton && !mouseButtonLast && mouseX > 0 && mouseX < 9 && mouseY > 0 && mouseY < 8)
  11.    {
  12.       i = 0;
  13.       while(i < pNum)
  14.       {
  15.          if(pX[i] == mouseX && pY[i] == mouseY && !pUsed[i])
  16.          {
  17.             drag = true;
  18.             grid._visible = true;
  19.             dragNum = i;
  20.             pObj1[dragNum]._alpha = 60;
  21.             pObj1[dragNum]._xscale = 110;
  22.             pObj1[dragNum]._yscale = 110;
  23.             pObj1[dragNum].swapDepths(3997);
  24.             pObj2[dragNum]._alpha = 60;
  25.             pObj2[dragNum]._xscale = 110;
  26.             pObj2[dragNum]._yscale = 110;
  27.             pObj2[dragNum].swapDepths(3998);
  28.             pObj3[dragNum]._alpha = 60;
  29.             pObj3[dragNum]._xscale = 110;
  30.             pObj3[dragNum]._yscale = 110;
  31.             pObj3[dragNum].swapDepths(3999);
  32.          }
  33.          i++;
  34.       }
  35.    }
  36.    mouseButtonLast = mouseButton;
  37.    if(drag)
  38.    {
  39.       pObj1[dragNum]._x = _xmouse;
  40.       pObj1[dragNum]._y = _ymouse;
  41.       pObj2[dragNum]._x = _xmouse;
  42.       pObj2[dragNum]._y = _ymouse;
  43.       pObj3[dragNum]._x = _xmouse;
  44.       pObj3[dragNum]._y = _ymouse;
  45.    }
  46.    if(status == "dead")
  47.    {
  48.       dead.dY += 0.6;
  49.       dead._x += dead.dX;
  50.       dead._y += dead.dY;
  51.       dead.count--;
  52.       if(dead.count == 0)
  53.       {
  54.          status = "buried";
  55.       }
  56.    }
  57.    if(timer == maxTimer)
  58.    {
  59.       musicWaiting.gotoAndPlay(2);
  60.    }
  61.    if(status == "waiting")
  62.    {
  63.       timer -= 0.05;
  64.    }
  65.    clock.gotoAndStop(1 + Math.floor(990 * (maxTimer - timer) / maxTimer));
  66.    if(timer < 10 && soundTime._currentframe == 1)
  67.    {
  68.       soundTime.gotoAndStop(2);
  69.    }
  70.    if(timer <= 0 && status == "waiting")
  71.    {
  72.       stopAllSounds();
  73.       timer = 0;
  74.       start2.gotoAndPlay("cageOpen");
  75.       start3.gotoAndPlay("cageOpen");
  76.       status = "moving";
  77.    }
  78.    if(Math.random() < 0.012 && cat._currentframe == 1)
  79.    {
  80.       if(hamsterY > 4)
  81.       {
  82.          cat._rotation = 180;
  83.          cat._y = -38;
  84.       }
  85.       else
  86.       {
  87.          cat._rotation = 0;
  88.          cat._y = 524;
  89.       }
  90.       var i = Math.floor(1 + 5.99 * Math.random());
  91.       switch(i)
  92.       {
  93.          case 1:
  94.             cat.swapDepths(4500);
  95.             cat.gotoAndPlay("catAppear1");
  96.             break;
  97.          case 2:
  98.             cat.swapDepths(500);
  99.             cat.gotoAndPlay("catAppear2");
  100.             break;
  101.          case 3:
  102.             cat.swapDepths(500);
  103.             cat.gotoAndPlay("catAppear3");
  104.             break;
  105.          case 4:
  106.             cat.swapDepths(4500);
  107.             cat.gotoAndPlay("catAppear4");
  108.             break;
  109.          case 5:
  110.             cat.swapDepths(500);
  111.             cat.gotoAndPlay("catAppear5");
  112.             break;
  113.          case 6:
  114.             cat.swapDepths(500);
  115.             cat.gotoAndPlay("catAppear6");
  116.       }
  117.       cat._x = 32 + 70 * hamsterX + Math.floor(70 * Math.random());
  118.    }
  119. }
  120.